﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace Bamboo.Core
{
    public interface IRepository : IDisposable
    {
        TEntity Get<TEntity>(object id);
        IList<TEntity> Get<TEntity>(Expression<Func<TEntity, bool>> filter);
        IQueryable<TEntity> Query<TEntity>(params string[] prefetchProperties);

        object Add(object entity);
        void Update(object entity);
        void Remove(object entity);
        void Refresh(object entity);
        void Stale(object entity);

        void AddOrUpdate(object entity);

        void ExecuteCommand(string command, params object[] parametter);

        IUnitOfWork CreateUnitOfWork();
    }
}
